#include <bits/stdc++.h>
using namespace std;
int a[100005];
int b[100005];
int c[100005];
int main()
{
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    int n;
    scanf("%d",&n);
    int jkl=0;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        b[a[i]]++;
        c[a[i]]++;
        jkl=max(jkl,a[i]);
    }
    int j=2;
    for(int i=1;i<=jkl;i++)
    {
        if(b[i]==0) continue;
        if(i>=j||c[j]==0)
        {
            j=i+1;
            while(c[j]==0&&j<=jkl) j++;
            if(j>jkl) break;
        }
        while(j<=jkl)
        {
            if(c[j]>=b[i])
            {
                c[j]-=b[i];
                b[i]=0;
                break;
            }
            else
            {
                b[i]-=c[j];
                c[j]=0;
                j++;
            }
        }
        if(j>jkl) break;
    }
    int ans=0;
    for(int i=1;i<=n;i++)
        ans+=b[i];
    printf("%d\n",ans);
    return 0;
}